<fieldset id="fd1" style="width:95%;margin:5px;">
    <legend><span>创建工单</span></legend>
    <div class="fieldset-body">
        <form action="/business/add/" method="post" id="my_add_form">
        <table class="form-table" border="0" cellpadding="1" cellspacing="2">
            <tr>
                <td class="form-label" style="width:80px;">工单类型:</td>
                <td style="width:120px"><input id="types" name="types" class="mini-combobox" textField="name" valueField="id" data="JS.CONST[5]" allowInput="true" style="width:100%;" /></td>
                <td class="form-label" style="width:120px;">选择客户:</td>
                <td style="width:120px"><input name="customs_id1" id="customs_id1" class="mini-buttonedit" emptyText="选择客户" onbuttonclick="onButtonEdit(this,'/common/customer')" style="width:100%;"/></td>
            </tr>
            <tr>
                <td class="form-label" style="width:120px;">售后单编号:</td>
                <td style="width:120px"><input id="order_sn" name="order_sn" class="mini-textbox" emptyText="请输入备用编号" style="width:100%;"/></td>
                <td class="form-label" style="width:120px;">施工组织机构:</td>
                <td style="width:120px"><input id="conagency" name="conagency" expandOnLoad="true" class="mini-treeselect" url="/common/agencyOne" multiSelect="false" textField="name" valueField="id" parentField="parent" checkRecursive="true" showFolderCheckBox="true" style="width:100%;"/></td>
            </tr>
            <tr>
                <td class="form-label" style="width:120px;">工单名称:</td>
                <td style="width:120px" colspan="3"><input id="title" name="title" class="mini-textbox" emptyText="请输入工单名称" style="width:100%;"/></td>
            </tr>
            <tr>
                <td class="form-label" style="width:120px;">工单内容:</td>
                <td style="width:120px" colspan="3">
                    <textarea id="content" name="content" class="mini-textbox-input" emptyText="请输入备用编号" style="width:100%; height: 120px;"/>
硬件类型：
硬件品牌：
硬件型号：
硬件名称：
                    </textarea>
                </td>
            </tr>
            <tr><td colspan="4">&nbsp;</td></tr>
            <tr>
                <td style="width:250px; text-align: center;"  colspan="4"><a class="mini-button" onclick="sub_addform()" iconCls="icon-add">添加工单...</a></td>
            </tr>
            <tr><td colspan="4">&nbsp;</td></tr>
            <tr><td colspan="4">&nbsp;</td></tr>
            <tr><td colspan="4">&nbsp;</td></tr>
            <tr><td colspan="4">&nbsp;</td></tr>
        </table>
        </form>
    </div>
</fieldset>


<iframe id="exportIFrame" style="display:none;"></iframe>
<script type="text/javascript">
    function sub_addform()
    {
        if ($.trim(mini.get("types").getValue()) == ""){
            parent.$.dooDialog.alert("请选择工单类型！");
            return;
        }
        if ($.trim(mini.get("customs_id1").getValue()) == ""){
            parent.$.dooDialog.alert("请选择客户！");
            return;
        }
        if ($.trim(mini.get("conagency").getValue()) == ""){
            parent.$.dooDialog.alert("请选择机构！");
            return;
        }

        if ($.trim(mini.get("title").getValue()) == ""){
            parent.$.dooDialog.alert("请填写工单名称！");
            return;
        }

//        if ($("#title").val() == ""){
//            parent.$.dooDialog.alert("请填写工单名称！");
//            return;
//        }

        if ($("#content").val() == ""){
            parent.$.dooDialog.alert("请填写工单内容！");
            return;
        }

        $.post($("#my_add_form").attr('action'),$("#my_add_form").serializeArray(),function(data){
            if(data.code=='OK'){
                parent.$.dooDialog.alert('工单信息录入成功！');
            }else{
                parent.$.dooDialog.alert('工单信息录入失败！');
                return false;
            }
        },'json');
    }
</script>